<html>
<head>
    <!--
     Licensed to the Apache Software Foundation (ASF) under one or more
     contributor license agreements.  See the NOTICE file distributed with
     this work for additional information regarding copyright ownership.
     The ASF licenses this file to You under the Apache License, Version 2.0
     (the "License"); you may not use this file except in compliance with
     the License.  You may obtain a copy of the License at

         http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
    -->
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Topology Visualization</title>
    <link href="/css/bootstrap-3.3.1.min.css" rel="stylesheet" type="text/css">
    <link href="/css/vis.min.css" rel="stylesheet" type="text/css" />
    <link href="/css/style.css?_ts=${packageTimestamp}" rel="stylesheet" type="text/css">
    <script src="/js/jquery-1.11.1.min.js" type="text/javascript"></script>
    <script src="/js/jquery.mustache.js" type="text/javascript"></script>
    <script src="/js/url.min.js" type="text/javascript"></script>
    <script src="/js/vis.min.js" type="text/javascript"></script>
    <script src="/js/visualization.js" type="text/javascript"></script>
</head>
<body>
<div id="visualization">
    <!-- Slide out for stream selection -->
    <div id="streams_slideout">
        <div id="streams_slideout_inner">
            <img src="/images/streams.png" alt="Streams" style="float: right;"/>
            <ul id="available-streams">
            </ul>
        </div>
    </div>

    <!-- Slide out for bolt stats -->
    <div id="bolt_slideout">
        <div id="bolt_slideout_inner">
            <img src="/images/component.png" alt="Component Info" class="header" style="float: left;"/>
            <ul id="bolt-details"></ul>
        </div>
    </div>

    <div id="mynetwork"></div>

    <!-- template for stream selector checkbox -->
    <script id="stream_selector_template" type="text/template">
        <li>
            <label>
                <input type="checkbox" id="stream-{{streamNameSanitized}}" class="stream_checkbox" onclick="checkStream(this);" {{checked}}>{{streamName}}
            </label>
        </li>
    </script>

    <!-- template for bolt info -->
    <script id="bolt_info_template" type="text/template">
        <!-- top level component details -->
        <li>Id: <a href="{{:link}}" target="_blank">{{:id}}</a> &#x25F3;</li>
        <li>Type: {{:type}}</li>
        <li>Latency: {{:latency}} ms</li>
        <li>Capacity: {{:capacity}}</li>
        <li>Transferred: {{:transferred}}</li>

        <!-- Inputs to Component -->
        <li>
            <details>
                <summary>{{:inputs_length}} Inputs</summary>
                <ul id="bolt-inputs">
                    <!-- Start loop over inputs -->
                    {{#:inputs}}
                    <li>
                        <details>
                            <summary>
                                {{#:show_link}}
                                    <a href="#" onclick="network.selectNodes(['{{:component}}']); handleNodeClickEvent('{{:component}}'); return false;">{{:component}}</a>
                                {{/:show_link}}
                                {{^:show_link}}
                                    {{:component}}
                                {{/:show_link}}
                            </summary>
                            <ul>
                                <li>Stream: {{:stream}}</li>
                                <li>Grouping: {{:grouping}}</li>
                            </ul>
                        </details>
                    </li>
                    {{/:inputs}}
                </ul>
            </details>
        </li>

        <!-- Instance Details -->
        <li>
            <details>
                <summary>
                    {{:stats_length}} Instance(s)
                </summary>
                <ul id="bolt-instances">
                    <!-- Start loop over instances -->
                    {{#:stats}}
                    <li>
                        <details>
                            <summary>
                                {{:host}}:{{:port}}
                            </summary>
                            <ul>
                                <li>Uptime: {{:uptime_str}}</li>
                            </ul>
                        </details>
                    </li>
                    {{/:stats}}
                </ul>
            </details>
        </li>
    </script>
</div>
</body>
</html>